package com.dao.student.imp;

import java.util.List;

import javax.annotation.Resource;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;
import com.dao.student.SorderDaoH;
import com.po.SorderH;

@Repository
public class SorderDaoHImpH implements SorderDaoH{
	
	@Resource(name="sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public List<SorderH> findOrderInfo(String student_id) {
		// TODO Auto-generated method stub
		List<SorderH> orderinfolist = sqlSessionTemplate.selectList("findOrderInfo", student_id);
		return orderinfolist;
	}

	@Override
	public int delOrder(String order_id) {
		// TODO Auto-generated method stub
		int result = sqlSessionTemplate.delete("delOrder", order_id);
		sqlSessionTemplate.delete("delOrderDish", order_id);
		return result;
	}

	@Override
	public int addOrder(SorderH order) {
		// TODO Auto-generated method stub
		
			int result = sqlSessionTemplate.insert("addOrder", order);
//			sqlSessionTemplate.insert("addOrderDish",order);
		return result;
	}

	@Override
	public List<SorderH> getOrderList() {
		// TODO Auto-generated method stub
		List<SorderH> list = sqlSessionTemplate.selectList("getOrderList");
		return list;
	}	
}
